namespace CSharpPro._1023;

public class Demo
{
    public static void TestPrint2(int[] array)
    {
        if (array == null || array.Length <= 1) return;
        
        for (int i = 0; i < array.Length - 1; i++)
        {
            for (int j = 0; j < array.Length - i - 1; j++)
            {
                if (array[j] > array[j + 1])
                {
                    // 交换元素
                    (array[j], array[j + 1]) = (array[j + 1], array[j]);
                }
            }
        }
    }
    
    // 打印数组
    public static void PrintArray(int[] array)
    {
        Console.WriteLine(string.Join(" ", array));
    }
    /*public void TestPrint()
    {
        int[] arr1 = new int[5];
        arr1[0] = 1;
        arr1[4] = 5;
    
        for (int i = 0; i < arr1.Length; i++)
        {
            Console.Write(arr1[i]+"\t");
        }
        
    } */
}